package com.example.shopping;

import com.example.shopping.dao.IBrandDao;
import com.example.shopping.dao.IUsrDao;
import com.example.shopping.pojo.Brand;
import com.example.shopping.pojo.User;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
class testBrand {
@Autowired
private IBrandDao brandDao ;
private int pageNum=1;
private int pageSize=2;
    @Test
    void selectBrandList() {
        PageHelper.startPage(pageNum,pageSize);
        List<Brand> brands = brandDao.selectListBrand();
        PageInfo pageInfo=new PageInfo(brands);
        System.out.println(pageInfo);
    }
    @Test
    void selectBrandOne() {

        PageHelper.startPage(pageNum,pageSize);
         brandDao.selectByOne(12);
    }

    @Test
    void insertBrand() {
        brandDao.insertBrand(new Brand("联想","哈哈哈"));
    }

    @Test
    void queryByLike() {
        String s ="华为";
        System.out.println(brandDao.queryLikeBrand(new Brand("%"+"三星"+"%","%"+"J"+"%")));
    }

    @Test
    void updateBrand() {
        System.out.println(brandDao.updateBrand(new Brand(17,"李涛","L")));
    }
    @Test
    void deleteIdBrand() {
        brandDao.deleteIdBrand(22);
    }

}
